<template>
	<div class="coontainer" @click="handleGallaryClick" >
		<div class="wrapper">
			<swiper :options="swiperOption" >
	      <swiper-slide v-for="(item,index) of gallaryImgs" :key="index"  >
	      		<img :src="item" class="gallary-img" />
	      </swiper-slide>
	      <div class="swiper-pagination" slot="pagination"></div>
	    </swiper>
		</div>
	</div>
</template>

<script type="text/javascript">
	export default {
		name: 'CommonGallary',
		data () {
			return {
				swiperOption: { 
					pagination: '.swiper-pagination', 
					paginationType: 'fraction',
					observer:true,
					observeParents:true,
					//解决父元素或自身元素发生dom改变时，出现宽度计算的问题
				},
			}
		},
		methods: {
			handleGallaryClick(){
				this.$emit('close')
			}
		},
		props: {
			gallaryImgs: {
				type: Array,
				default () {
					return []
				}
			}
		},
	};
</script>

<style lang="stylus" scoped>
	.coontainer >>> .swiper-container
		overflow: inherit
	.coontainer
		overflow: hidden
		position: absolute
		left: 0
		top: 0
		bottom: 0
		right: 0
		background: #000
		z-index: 9999
		display: flex
		flex-direction: column
		justify-content: center
		.wrapper
			height: 0
			width: 100%
			padding-bottom:100%
			.gallary-img
				width: 100%
			.swiper-pagination
				color: #fff
				bottom: -1rem
</style>